package com.ruyuan.seckilling.render.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.Comparator;
import java.util.List;

/**
 * @author zhonghuashishan
 */
@Component
public class BussinessConfig {

    private static String nginxServerIps;

    public static String getNginxServerIps() {
        return nginxServerIps;
    }

    @Value("${business.nginxServerIps}")
    public void setNginxServerIps(String nginxServerIps) {
        List<String> list = Arrays.asList(nginxServerIps.split(","));
        list.sort(Comparator.comparing(e -> e));
        BussinessConfig.nginxServerIps = String.join(",", list);
    }
}
